import { Component, OnInit } from '@angular/core';
import { Singlepage } from '../../model/singlepage';
import { SinglepageService } from '../../service/singlepage.service';
import { Router } from '@angular/router';

@Component({
  selector: 'app-singlepagelist',
  templateUrl: './singlepagelist.component.html',
  styleUrls: ['./singlepagelist.component.css']
})
export class SinglepagelistComponent implements OnInit {
  sl:Array<Singlepage>;

  constructor(
    private router:Router,
    private singlepageservice:SinglepageService
  ) { 
    this.sl=new Array();
  }

  ngOnInit() {
    this.sl=new Array();
   this.singlepageservice.getSinglepageList()
   .then((data:any)=>{
this.sl=data;
console.log(this.sl[0].title);

   })
  }

  toDetail(id:string){

    this.router.navigate(['detailsinglepage',id]);

    }

}
